package com.guchenbo.spark.core

/**
 * @author guchenbo
 * @date 2022/3/5
 */
object RddCoalesce {
  def main(args: Array[String]): Unit = {
    val sc = SparkUtils.sc("RddCoalesce")
    var rdd = sc.makeRDD(List(1, 2, 3, 3, 4, 4, 5, 6, 7, 8, 9), 4)
    rdd = rdd.distinct()
    rdd = rdd.coalesce(2, shuffle = true)
    rdd.saveAsTextFile("output/coalesce")
    //.collect().foreach(println)
  }
}
